package com.oak.interviewdemo.sys.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oak.interviewdemo.sys.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.oak.interviewdemo.sys.entity.dto.UserDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author guoxy
 * @since 2020-05-10
 */
@Repository
public interface UserMapper extends BaseMapper<User> {
    /**
     * 自定义sql分页
     *
     * @param page
     * @param queryWrapper 看这里看这里，如果自定义的方法中需要用到wrapper查询条件，需要这样写
     * @return
     */
    IPage<User> selectPageVo(IPage<User> page, @Param(Constants.WRAPPER) Wrapper<User> queryWrapper);

    /**
     * 通过用户名查找
     *
     * @param username
     * @return
     */
    UserDto selectByUsername(String username);
}
